<form method="post" action="" enctype="multipart/form-data">
    <div class="col-xs-12 col-md-12 col-lg-12 padding-none lists">
        <div class="col-lg-2 col-md-3 col-xs-5 filed-name text-right">客服电话<pub>*</pub> :</div>
        <div class="col-lg-3 col-md-5 col-xs-7 filed-from padding-none">
            <input type="text" class="form-control radius-none tel" name="tel" value="<?php echo $data[0]['tel']?>">
            <input type="hidden" value="<?php echo $data[0]['id']?>" name="id" />
        </div>
    </div>

    <div class="col-xs-12 col-md-12 col-lg-12 padding-none lists">
        <div class="col-lg-2 col-md-3 col-xs-5 filed-name text-right">客服QQ<pub>*</pub> :</div>
        <div class="col-lg-3 col-md-5 col-xs-7 filed-from padding-none">
            <input type="text" class="form-control radius-none qq" name="qq" value="<?php echo $data[0]['qq']?>">
        </div>
    </div>

    <div class="col-xs-12 col-md-12 col-lg-12 padding-none lists">
        <div class="col-lg-2 col-md-3 col-xs-5 filed-name text-right">微信号<pub>*</pub> :</div>
        <div class="col-lg-3 col-md-5 col-xs-7 filed-from padding-none">
            <input type="text" class="form-control radius-none wechat" name="wechat" value="<?php echo $data[0]['wechat']?>">
        </div>
    </div>

    <div class="col-xs-12 col-md-12 col-lg-12 padding-none lists">
        <div class="col-lg-2 col-md-3 col-xs-5 filed-name text-right">二维码<pub>*</pub> :</div>
        <div class="col-lg-3 col-md-5 col-xs-7 filed-from padding-none">
            <img src="">
        </div>
    </div>

    <div class="col-xs-12 col-md-12 col-lg-12 lists text-right">
        <input type="submit" class="btn btn-success radius-none" value="确认修改" name="dosubmit">
        <input type="reset" class="btn btn-info radius-none" value="重置">
    </div>
</form>
<script>

    $(document).ready(function(){

        $('.btn-success').click(function(e){
            var id = $('input[type=hidden]').val();
            var url = '<?php echo U("Admin/Basic/CustomService/save")?>';
            var tel_num = $('.tel').val();
            var wechat = $('.wechat').val();
            var qq = $('.qq').val();

            var isMob=/^1[3-5,8]{1}[0-9]{9}$/;
            var isTel=/^([0-9]{3,4}-)?[0-9]{7,8}$/;

            if(!id){
                alert('参数有误');
                return false;
            }

            if(!tel_num){
                alert('请输入客服联系电话');
                return false;
            }

            if(!isMob.test(tel_num) && !isTel.test(tel_num)){
                alert('请输入正确的客服联系电话');
                return false;
            }

            if(!qq){
                alert('请输入客服qq');
                return false;
            }

            if(isNaN(qq)){
                alert('客服qq格式有误');
                return false;
            }

            if(!wechat){
                alert('请输入客服微信号');
                return false;            
            }

            e.preventDefault();

            $.post(url,{'id':id,'tel':tel_num,'wechat':wechat,'qq':qq},function(res){
                alert(res.msg);
            })
            
        })
    })
</script>